<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('meeting/room/index')}">展位管理</a></li>
        <li><a data-toggle="modal" onclick="check('')">添加展位</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('meeting/room/index')}">
        展位编号：
        <input class="form-control" type="text" name="number" style="width: 200px;" value="{:input('request.number')}"
               placeholder="">
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('meeting/room/index')}">清空</a>
    </form>
    <a style="float: right;margin-left: 10px;" href="{:url('meeting/room/refund')}" class="btn btn-primary">押金退款</a>
    <a style="float: right;margin-left: 10px;" href="{:url('meeting/order/showPayOrderAll')}" class="btn btn-success">付款通知单(全部)</a>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>展位编号</th>
                <th>参展单位</th>
                <th>录入时间</th>
                <th>审图状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <php>
                $status=['0'=>'未提交','1'=>'待确认','2'=>'已确认','3'=>'已拒绝'];
            </php>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td><a data-toggle="modal" onclick="check({$vo['room_id']})">{$vo.number}</a></td>
                    <td>{$vo.exhibitor_name}</td>
                    <td>{:date('Y-m-d H:i:s',$vo['add_time'])}</td>
                    <td>{$status[$vo['is_sure']]}</td>
                    <td>
                        <if condition="$vo['is_sure'] eq 2">
                            <a href="{:url('picture',['room_id'=>$vo['room_id']])}" class="btn btn-success">报图</a>
                            <a href="{:url('meeting/order/showPayOrder',['room_id'=>$vo['room_id']])}" class="btn btn-primary">付款通知单</a>
                            <a href="{:url('meeting/order/fee')}" class="btn btn-success">缴费</a>
                            <else />
                            <a href="javascript:void(0)" class="btn btn-success" disabled="disabled">报图</a>
                            <a href="{:url('meeting/order/showPayOrder',['room_id'=>$vo['room_id']])}" class="btn btn-primary">付款通知单</a>
                            <a href="javascript:void(0)" class="btn btn-success" disabled="disabled">缴费</a>
                        </if>
                        <a href="{:url('meeting/order/showPayOrder2',['room_id'=>$vo['room_id']])}" class="btn btn-primary">电费</a>
                        <a href="{:url('bill',['room_id'=>$vo['room_id']])}" class="btn btn-warning">发票</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
    </form>
    <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h5 class="modal-title" id="myModalLabel" style="font-size: 16px;">审核</h5>
                </div>
                <form action="{:url('bindPost')}"  method="post" class="form" >
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="">展馆</label>
                            <select  onchange="showroom(this)">
                                <option value="">选择展馆</option>
                                <foreach name="showroom" item="v">
                                    <option value="{$v.showroom_id}">{$v.title}</option>
                                </foreach>
                            </select>
                            <label for="">展位编号</label>
                            <select  id="rooms"   onchange="room(this)">
                                <option value=""></option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="">长</label>
                            <input type="text" name="lang" id="lang" readonly  value="">
                            <label for="">宽</label>
                            <input type="text" name="width" id="width" readonly  value="">
                            <label for="">面积</label>
                            <input type="text" name="area" id="area" readonly  value="">
                        </div>

                        <div class="form-group">
                            <label for="two">是否双层</label>
                            <input type="radio" onclick="twoo(this)" id="two1" name="two" value="1">是
                            <input type="radio" onclick="twoo(this)"  id="two0" checked name="two" value="0">否
                            <label for="two_area">面积</label>
                            <input type="number" min="0.00" step="0.01" disabled="disabled" name="two_area" id="two_area" value="" />
                        </div>

                        <div class="form-group">
                            <input  class="form-control" type="text" name="exhibitor_name"  id="exhibitor_name" value=""  placeholder="参展商名称">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="linkman" id="linkman"  value=""  placeholder="参展商负责人">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="exhibitor_phone" id="exhibitor_phone"  value=""  placeholder="参展商手机号">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="builder_name" id="builder_name"  value=""  placeholder="搭建商名称">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="builder_phone" id="builder_phone"  value=""  placeholder="搭建商手机号">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="company" id="company" readonly  value=""  placeholder="汇款名称">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="bank_name" id="bank_name" readonly value=""  placeholder="汇款银行">
                        </div>
                        <div class="form-group">
                            <input  class="form-control" type="text" name="bank_no" id="bank_no" readonly value=""  placeholder="汇款银行卡号">
                        </div>
                        <div class="form-group" id="reasons" style="display: none">
                            <label for="">拒绝理由</label>
                            <p id="reason"  ></p>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <input type="hidden" id="number" name="number" value=""/>
                        <input type="hidden" id="room_id" name="room_id" value=""/>
                        <input type="hidden" id="showroom_id" name="showroom_id" value=""/>
                        <button type="submit" id="submit" class="btn btn-success ">提交</button>
                    </div>
                    <div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
                        <div style="width: 100%;height: 50px;background-color: white;font-size: .8cm;padding-top: 10px;" align="center">
                            查看图片
                        </div>
                        <div id="innerdiv" style="position:absolute;">
                            <img id="bigimg" style="border:5px solid #fff;" src="" />
                        </div>
                    </div>
                </form>

            </div>
        </div>
    </div>

</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    function check(id) {
        $('#myModal2').modal('show')
        if(id){
            $('#myModalLabel').text('详情')
            $.post("{:url('roomInfo')}",{room_id:id},function (res) {
                console.log(res)
                if(res.data){
                    if(res.data.is_sure==1||res.data.is_sure==2){
                        // 待确认 已确认 不可修改信息
                        $('#showroom_id').val(res.data.showroom_id)
                        $('#room_id').val(res.data.room_id)
                        $('#number').val(res.data.number)
                        $('#lang').val(res.data.lang)
                        $('#width').val(res.data.width)
                        $('#area').val(res.data.area)
                        $('#two_area').val(res.data.two_area)
                        $('#exhibitor_phone').val(res.data.exhibitor_phone)
                        $('#exhibitor_name').val(res.data.exhibitor_name)
                        $('#linkman').val(res.data.linkman)
                        $('#builder_name').val(res.data.builder_name)
                        $('#builder_phone').val(res.data.builder_phone)
                        $('#company').val(res.data.company)
                        $('#bank_name').val(res.data.bank_name)
                        $('#bank_no').val(res.data.bank_no)

                        $('#room_id').attr('disabled',true)
                        $('#showroom_id').attr('disabled',true)
                        $('#exhibitor_phone').attr('disabled',true)
                        $('#exhibitor_name').attr('disabled',true)
                        $('#linkman').attr('disabled',true)
                        $('#builder_name').attr('disabled',true)
                        $('#builder_phone').attr('disabled',true)
                        $('#two_area').attr('disabled',true)
                        $('#reasons').css('display','none')
                        $('#submit').css('display','none')

                    }else {
                        // 拒绝 可修改信息
                        $('#showroom_id').val(res.data.showroom_id)
                        $('#room_id').val(res.data.room_id)
                        $('#number').val(res.data.number)
                        $('#lang').val(res.data.lang)
                        $('#width').val(res.data.width)
                        $('#area').val(res.data.area)
                        $('#two_area').val(res.data.two_area)
                        $('#exhibitor_phone').val(res.data.exhibitor_phone)
                        $('#exhibitor_name').val(res.data.exhibitor_name)
                        $('#linkman').val(res.data.linkman)
                        $('#builder_name').val(res.data.builder_name)
                        $('#builder_phone').val(res.data.builder_phone)
                        $('#company').val(res.data.company)
                        $('#bank_name').val(res.data.bank_name)
                        $('#bank_no').val(res.data.bank_no)
                        if(res.data.two==1){
                            $('#two_area').attr('disabled',false)
                        }else{
                            $('#two_area').attr('disabled',true)
                        }
                        $('#reason').text(res.data.reason)
                        $('#reasons').css('display','')
                        $('#submit').css('display','')

                    }

                }

            })


        }else{
            $('#myModalLabel').text('添加展位')
        }
        $.post("{:url('builderInfo')}",{builder_id:0},function (res) {
            if (res) {

                $('#builder_name').val(res.builder_name)
                $('#builder_phone').val(res.phone)
                $('#company').val(res.company)
                $('#bank_name').val(res.bank_name)
                $('#bank_no').val(res.bank_no)
            }

        })

    }

    function showroom(obj) {
        var  data =  {}
        $('#showroom_id').val($(obj).val())
        data.showroom_id=  $('#showroom_id').val()
        if (data.showroom_id){
            $.post("{:url('roomList')}",data,function (res) {
                if (res.data.length>0) {
                    var h = '<option value="">选择展位</option>'
                    for (var i=0;i<res.data.length;i++){
                        h +='<option  value="'+ res.data[i].room_id +'">'+ res.data[i].number +'</option>'
                    }
                    $('#rooms').html(h)
                }

            })
        }

    }

    function room(obj) {
        var  data =  {}
        $('#room_id').val($(obj).val())
        data.room_id=  $('#room_id').val()
        if(data.room_id){
            $.post("{:url('roomInfo')}",data,function (res) {
                if(res.data){
                    $('#number').val(res.data.number)
                    $('#lang').val(res.data.lang)
                    $('#width').val(res.data.width)
                    $('#area').val(res.data.area)
                    $('#two_area').val(res.data.two_area)
                }

            })
        }

    }
    function twoo(obj) {
        var v = $(obj).val()
        if(v==1){
            $('#two_area').attr('disabled',false)
        }else{
            $('#two_area').attr('disabled',true)
        }
    }
</script>
</body>
</html>